Definition
For a producer, the zero-profit condition (written in value terms and evaluated at price faced by the the firm (agent price) is:

i: index of endowment (value added)
k: index of tradable goods (intermediate inputs)
Write in the form of Value = Price * Quantity, then we have:
Total differentiate the equation and eliminate the terms with quantity change using the result that the price-weighted output quantity equals the sum of price weighted input quantity change, due to constant return to scale and cost minimization, we get:

This is the equation of zero profit
Procedure of this conversion
From total differentiation, I can have:

\
In order to have the function above, we need to have:

Or:
from Constant return to scale (CRTS), by multiply and divide by quantity Q simultaneously.
This equation is based on "with constant return to scale and cost minimization, price-weighted output quantity change equals to sum of price weighted input quantity change"